package com.chj.chuji.tijie14;

import java.util.ArrayList;

//https://www.cnblogs.com/A-sc/p/13444594.html
//https://blog.nowcoder.net/n/1317c459eb2a4925a7ff78f9e6f39e4f
public class BlueMage02 {

	public static void dfs(int u, int pre) {
		siz[u] = 1;
		dp[u][1] = 1;
		for (int i = 0; i < g[u].arr.size(); ++i) {
			int v = g[u].arr.get(i);
			if (v == pre)
				continue;
			dfs(v, u);

			int sum = 0;
			for (int j = 1; j <= Math.min(k, siz[v]); ++j)
				sum = (sum + dp[v][j]) % mod;
			for (int j = Math.min(k, siz[u]); j >= 1; --j) {
				for (int z = Math.min(k, siz[v]); z >= 1; --z) {
					if (j + z <= k)
						dp[u][j + z] = (dp[u][j + z] + dp[u][j] * dp[v][z]) % mod;
				}
				dp[u][j] = (dp[u][j] * sum) % mod;
			}
			siz[u] += siz[v];
		}
	}

	public static class ArrList {
		public ArrayList<Integer> arr;

		public ArrList() {
			arr = new ArrayList<Integer>();
		}
	}

	public static final int N = (int) (2e3 + 15);
	public static final int mod = 998244353;
	public static int n;
	public static int k;
	public static int[][] dp = new int[N][N];
	public static int[] siz = new int[N];
//	vector<int>g[N];
	public static ArrList[] g = new ArrList[N];

	public static void main(String[] args) {

		n = 5;
		k = 2;

//	    for(int i = 1; i < n; ++ i){
//	        int x, y; scanf("%d%d",&x,&y);
//	        g[x].push_back(y); g[y].push_back(x);
//	    }

//		1 2
//		1 3
//		2 4
//		2 5

		ArrList arr02 = new ArrList();
		arr02.arr.add(2);
		arr02.arr.add(3);
		g[1] = arr02;

		ArrList arr03 = new ArrList();
		arr03.arr.add(4);
		arr03.arr.add(5);
		arr03.arr.add(1);
		g[2] = arr03;

		ArrList arr04 = new ArrList();
		arr04.arr.add(1);
		g[3] = arr04;

		ArrList arr05 = new ArrList();
		arr05.arr.add(2);
		g[4] = arr05;

		ArrList arr06 = new ArrList();
		arr06.arr.add(2);
		g[5] = arr06;

		dfs(1, 0);

		int res = 0;
		for (int i = 1; i <= k; ++i) {
			res = (res + dp[1][i]) % mod;
		}
//		printf("%d\n", res);
		System.out.println(res);
	}
}

//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<algorithm>
//#include<cmath>
//#include<map>
//#include<queue>
//#include<vector>
//#include<string>
//#include<fstream>
//using namespace std;
//#define rep(i, a, n) for(int i = a; i <= n; ++ i)
//#define per(i, a, n) for(int i = n; i >= a; -- i)
//typedef long long ll;
//const int N = 2e3 + 15;
//const int mod = 998244353;
//const double Pi = acos(- 1.0);
//const int INF = 0x3f3f3f3f;
//const int G = 3, Gi = 332748118;
//ll qpow(ll a, ll b) { ll res = 1; while(b){ if(b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1;} return res; }
//ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
////
//
//int n, k;
//int dp[N][N], siz[N];
//vector<int> g[N];
//
//void dfs(int u, int pre){
//    siz[u] = 1; dp[u][1] = 1;
//    for(int i = 0; i < g[u].size(); ++ i){
//        int v = g[u][i];
//        if(v == pre) continue;
//        dfs(v, u);
//        
//        int sum = 0;
//        for(int j = 1; j <= min(k, siz[v]); ++ j) sum = (sum + dp[v][j]) % mod;
//        for(int j = min(k, siz[u]); j >= 1; -- j){
//            for(int z = min(k, siz[v]); z >= 1; -- z){
//                if(j + z <= k)
//                    dp[u][j + z] = (dp[u][j + z] + 1ll * dp[u][j] * dp[v][z]) % mod;
//            }
//            dp[u][j] = (1ll * dp[u][j] * sum) % mod;
//        }
//        siz[u] += siz[v];
//    }
//}
//
//int main()
//{
//    scanf("%d%d",&n,&k);
//    for(int i = 1; i < n; ++ i){
//        int x, y; scanf("%d%d",&x,&y);
//        g[x].push_back(y); g[y].push_back(x);
//    }
//    dfs(1, 0);
//    
//    int res = 0;
//    for(int i = 1; i <= k; ++ i) res = (res + dp[1][i]) % mod;
//    printf("%d\n",res);
//    return 0;
//}
